/* Layout */
import Layout from '@/layout/index.vue'

//对外暴露配置路由(常量路由):全部用户都可以访问到的路由
export const constantRoute = [
  {
    path: '/',
    name: 'home',
    component: Layout,
    redirect: '/workbench',
    children: [
      {
        path: '/workbench',
        name: 'workbench',
        meta: { title: '工作台', icon: 'DataAnalysis' },
        component: () => import('@/views/Workbench/index.vue')
      }
    ]
  },
  {
    path: '/excel',
    component: Layout,
    redirect: '/excel/demo',
    meta: { title: 'Excel', icon: 'Message' },
    children: [
      {
        path: '/excel/demo',
        name: 'excelDemo',
        meta: { title: 'Excel', icon: 'Tickets' },
        component: () => import('@/views/Excel/index.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login/index.vue'),
    meta: { title: '登录', hidden: true }
  },
  {
    //404
    path: '/404',
    component: () => import('@/views/NotFound/index.vue'),
    name: '404',
    meta: {
      title: '404',
      hidden: true,
      icon: 'DocumentDelete'
    }
  }
]
// 常量路由白名单
export const routeWhiteList = ['home', 'workbench', 'login', '404', 'excelDemo']

//异步路由
export const asnycRoute = [
  {
    path: '/leaveword',
    component: Layout,
    redirect: '/leaveword/list',
    permission: 'leaveword',
    meta: { title: '留言管理', icon: 'Message' },
    children: [
      {
        path: '/leaveword/list',
        name: 'leavewordList',
        permission: 'leaveword:list',
        meta: { title: '留言列表', icon: 'Memo' },
        component: () => import('@/views/Leaveword/List/index.vue')
      },
      {
        path: '/leaveword/feedback',
        name: 'leavewordFeedback',
        permission: 'leaveword:feedback',
        meta: { title: '反馈管理', icon: 'Postcard' },
        component: () => import('@/views/Leaveword/Feedback/index.vue')
      }
    ]
  },
  {
    path: '/wall',
    component: Layout,
    redirect: '/leave/list',
    permission: 'wall',
    meta: { title: '墙管理', icon: 'MessageBox' },
    children: [
      {
        path: '/wall/list',
        name: 'wallList',
        permission: 'wall:list',
        meta: { title: '墙列表', icon: 'Tickets' },
        component: () => import('@/views/Wall/List/index.vue')
      },
      {
        path: '/wall/label',
        name: 'wallLabel',
        permission: 'wall:label',
        meta: { title: '标签管理', icon: 'CollectionTag' },
        component: () => import('@/views/Wall/Label/index.vue')
      },
      {
        path: '/wall/color',
        name: 'wallColor',
        permission: 'wall:color',
        meta: { title: '颜色管理', icon: 'CreditCard' },
        component: () => import('@/views/Wall/Color/index.vue')
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    permission: 'user',
    redirect: '/user/list',
    children: [
      {
        path: '/user/list',
        name: 'userList',
        permission: 'user:list',
        meta: { title: '用户管理', icon: 'User' },
        component: () => import('@/views/User/index.vue')
      }
    ]
  },
  {
    path: '/admin',
    component: Layout,
    permission: 'admin',
    redirect: '/admin/list',
    children: [
      {
        path: '/admin/list',
        name: 'adminList',
        permission: 'admin:list',
        meta: { title: '管理员管理', icon: 'SetUp' },
        component: () => import('@/views/Admin/index.vue')
      }
    ]
  },
  {
    path: '/role',
    component: Layout,
    permission: 'role',
    redirect: '/role/list',
    children: [
      {
        path: '/role/list',
        name: 'roleList',
        permission: 'role:list',
        meta: { title: '角色管理', icon: 'Key' },
        component: () => import('@/views/Role/index.vue')
      }
    ]
  }
]

//任意路由
export const anyRoute = {
  //任意路由
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  name: 'Any'
}
